/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * <p>Project: app2022 - T10
 * <p>Powered by webrx On 2022-01-27 15:35:31
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class T10 {
    public static void main(String[] args) throws ParseException {
        Timer timer = new Timer();
        //5秒后开始线程执行，以后每一秒执行一次任务
        /*
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello");
                timer.cancel();
            }
        }, 5000, 1000);*/
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //java.util.Date()
        Date d = sdf.parse("2022-01-27 15:42:00");
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello");
            }
        }, d, 3000);
        
    }
}
